package com.weseal.dry.controller;

import common.response.CommonResult;
import common.response.UploadResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

/**
 * @title
 * @description
 * @usage
 * @copyright Copyright 2014  rrmj Corporation. All rights reserved.
 * @company 上海众多美网络科技有限公司
 * @author weseal
 * @create 2018/4/6
 */

@RequestMapping("/upload")
@Controller
public class UploadController {

	@ResponseBody
	@RequestMapping("/image")
	public CommonResult upload(@RequestParam("file") MultipartFile file){
		UploadResult result = new UploadResult("200");
		result.setUrl("http://localhost:9999/static/repository/images/ch2.jpg");
		result.setName(file.getName());
		result.setOriginalName(file.getOriginalFilename());
		result.setSize(file.getSize());
		result.setState("SUCCESS");

		return result;
	}

}
